.class public Lcom/brixd/niceapp/util/DetailRequestCache;
.super Ljava/lang/Object;
.source "DetailRequestCache.java"


# instance fields
.field private mAppModelCaches:Landroid/util/SparseArray;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/util/SparseArray",
            "<",
            "Ljava/lang/ref/SoftReference",
            "<",
            "Lcom/brixd/niceapp/model/BaseAppModel;",
            ">;>;"
        }
    .end annotation
.end field

.field private mAppModelTitleCaches:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/ref/SoftReference",
            "<",
            "Lcom/brixd/niceapp/model/BaseAppModel;",
            ">;>;"
        }
    .end annotation
.end field

.field private mContext:Landroid/content/Context;

.field private mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

.field private mRequest:Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;

.field private mScrollToComment:Z

.field private mScrollToUpUsers:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 4
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    const/4 v1, 0x0

    .line 38
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 28
    new-instance v0, Landroid/util/SparseArray;

    invoke-direct {v0}, Landroid/util/SparseArray;-><init>()V

    iput-object v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mAppModelCaches:Landroid/util/SparseArray;

    .line 29
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mAppModelTitleCaches:Ljava/util/HashMap;

    .line 35
    iput-boolean v1, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToUpUsers:Z

    .line 36
    iput-boolean v1, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToComment:Z

    .line 39
    iput-object p1, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    .line 40
    iget-object v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    invoke-static {v0}, Lcom/brixd/niceapp/service/adapter/ReqRestAdapter;->niceAppAdapter(Landroid/content/Context;)Lretrofit/RestAdapter;

    move-result-object v0

    const-class v1, Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;

    invoke-virtual {v0, v1}, Lretrofit/RestAdapter;->create(Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;

    iput-object v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mRequest:Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;

    .line 41
    return-void
.end method

.method static synthetic access$000(Lcom/brixd/niceapp/util/DetailRequestCache;)Landroid/util/SparseArray;
    .registers 2
    .param p0, "x0"    # Lcom/brixd/niceapp/util/DetailRequestCache;

    .prologue
    .line 26
    iget-object v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mAppModelCaches:Landroid/util/SparseArray;

    return-object v0
.end method

.method static synthetic access$100(Lcom/brixd/niceapp/util/DetailRequestCache;)Landroid/content/Context;
    .registers 2
    .param p0, "x0"    # Lcom/brixd/niceapp/util/DetailRequestCache;

    .prologue
    .line 26
    iget-object v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$200(Lcom/brixd/niceapp/util/DetailRequestCache;)Z
    .registers 2
    .param p0, "x0"    # Lcom/brixd/niceapp/util/DetailRequestCache;

    .prologue
    .line 26
    iget-boolean v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToUpUsers:Z

    return v0
.end method

.method static synthetic access$300(Lcom/brixd/niceapp/util/DetailRequestCache;)Z
    .registers 2
    .param p0, "x0"    # Lcom/brixd/niceapp/util/DetailRequestCache;

    .prologue
    .line 26
    iget-boolean v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToComment:Z

    return v0
.end method

.method static synthetic access$400(Lcom/brixd/niceapp/util/DetailRequestCache;)Lcom/zuiapps/suite/utils/hud/ProgressHUD;
    .registers 2
    .param p0, "x0"    # Lcom/brixd/niceapp/util/DetailRequestCache;

    .prologue
    .line 26
    iget-object v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    return-object v0
.end method

.method static synthetic access$500(Lcom/brixd/niceapp/util/DetailRequestCache;)Ljava/util/HashMap;
    .registers 2
    .param p0, "x0"    # Lcom/brixd/niceapp/util/DetailRequestCache;

    .prologue
    .line 26
    iget-object v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mAppModelTitleCaches:Ljava/util/HashMap;

    return-object v0
.end method


# virtual methods
.method public gotoDetail(IZ)V
    .registers 11
    .param p1, "appId"    # I
    .param p2, "isClearTop"    # Z

    .prologue
    .line 58
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mAppModelCaches:Landroid/util/SparseArray;

    invoke-virtual {v3, p1}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/ref/SoftReference;

    .line 59
    .local v0, "cache":Ljava/lang/ref/SoftReference;, "Ljava/lang/ref/SoftReference<Lcom/brixd/niceapp/model/BaseAppModel;>;"
    if-eqz v0, :cond_44

    .line 60
    invoke-virtual {v0}, Ljava/lang/ref/SoftReference;->get()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/brixd/niceapp/model/BaseAppModel;

    .line 61
    .local v1, "cachedModel":Lcom/brixd/niceapp/model/BaseAppModel;
    if-eqz v1, :cond_44

    .line 63
    new-instance v2, Landroid/content/Intent;

    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    const-class v4, Lcom/brixd/niceapp/activity/NiceAppDetailActivity;

    invoke-direct {v2, v3, v4}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 64
    .local v2, "intent":Landroid/content/Intent;
    const-string v3, "AppModel"

    invoke-virtual {v2, v3, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    .line 65
    const-string v3, "ScrollToUpUsers"

    iget-boolean v4, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToUpUsers:Z

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 66
    const-string v3, "ScrollToComment"

    iget-boolean v4, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToComment:Z

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 67
    if-eqz p2, :cond_3a

    .line 68
    const/high16 v3, 0x4000000

    invoke-virtual {v2, v3}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 69
    const/high16 v3, 0x20000000

    invoke-virtual {v2, v3}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;

    .line 72
    :cond_3a
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    if-eqz v3, :cond_43

    .line 73
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    invoke-virtual {v3, v2}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 112
    .end local v1    # "cachedModel":Lcom/brixd/niceapp/model/BaseAppModel;
    .end local v2    # "intent":Landroid/content/Intent;
    :cond_43
    :goto_43
    return-void

    .line 79
    :cond_44
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    const-string v4, ""

    const v5, 0x7f040003

    const/4 v6, 0x1

    const/4 v7, 0x0

    invoke-static {v3, v4, v5, v6, v7}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->show(Landroid/content/Context;Ljava/lang/CharSequence;IZLandroid/content/DialogInterface$OnCancelListener;)Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    move-result-object v3

    iput-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    .line 80
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    const/4 v4, 0x0

    invoke-virtual {v3, v4}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->setCanceledOnTouchOutside(Z)V

    .line 81
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mRequest:Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;

    new-instance v4, Lcom/brixd/niceapp/util/DetailRequestCache$1;

    invoke-direct {v4, p0, p1, p2}, Lcom/brixd/niceapp/util/DetailRequestCache$1;-><init>(Lcom/brixd/niceapp/util/DetailRequestCache;IZ)V

    invoke-interface {v3, p1, v4}, Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;->queryDetail(ILretrofit/Callback;)V

    goto :goto_43
.end method

.method public gotoDetail(Ljava/lang/String;)V
    .registers 10
    .param p1, "title"    # Ljava/lang/String;

    .prologue
    .line 115
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mAppModelTitleCaches:Ljava/util/HashMap;

    invoke-virtual {v3, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/ref/SoftReference;

    .line 116
    .local v0, "cache":Ljava/lang/ref/SoftReference;, "Ljava/lang/ref/SoftReference<Lcom/brixd/niceapp/model/BaseAppModel;>;"
    if-eqz v0, :cond_38

    .line 117
    invoke-virtual {v0}, Ljava/lang/ref/SoftReference;->get()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/brixd/niceapp/model/BaseAppModel;

    .line 118
    .local v1, "cachedModel":Lcom/brixd/niceapp/model/BaseAppModel;
    if-eqz v1, :cond_38

    .line 120
    new-instance v2, Landroid/content/Intent;

    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    const-class v4, Lcom/brixd/niceapp/activity/NiceAppDetailActivity;

    invoke-direct {v2, v3, v4}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 121
    .local v2, "intent":Landroid/content/Intent;
    const-string v3, "AppModel"

    invoke-virtual {v2, v3, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    .line 122
    const-string v3, "ScrollToUpUsers"

    iget-boolean v4, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToUpUsers:Z

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 123
    const-string v3, "ScrollToComment"

    iget-boolean v4, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToComment:Z

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 125
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    if-eqz v3, :cond_37

    .line 126
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    invoke-virtual {v3, v2}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 159
    .end local v1    # "cachedModel":Lcom/brixd/niceapp/model/BaseAppModel;
    .end local v2    # "intent":Landroid/content/Intent;
    :cond_37
    :goto_37
    return-void

    .line 132
    :cond_38
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mContext:Landroid/content/Context;

    const-string v4, ""

    const v5, 0x7f040003

    const/4 v6, 0x1

    const/4 v7, 0x0

    invoke-static {v3, v4, v5, v6, v7}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->show(Landroid/content/Context;Ljava/lang/CharSequence;IZLandroid/content/DialogInterface$OnCancelListener;)Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    move-result-object v3

    iput-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    .line 133
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    const/4 v4, 0x0

    invoke-virtual {v3, v4}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->setCanceledOnTouchOutside(Z)V

    .line 134
    iget-object v3, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mRequest:Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;

    const/4 v4, 0x2

    new-instance v5, Lcom/brixd/niceapp/util/DetailRequestCache$2;

    invoke-direct {v5, p0, p1}, Lcom/brixd/niceapp/util/DetailRequestCache$2;-><init>(Lcom/brixd/niceapp/util/DetailRequestCache;Ljava/lang/String;)V

    invoke-interface {v3, p1, v4, v5}, Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;->queryAppByTitle(Ljava/lang/String;ILretrofit/Callback;)V

    goto :goto_37
.end method

.method public setScrollToUpUsers(Z)V
    .registers 3
    .param p1, "scrollToUpUsers"    # Z

    .prologue
    .line 44
    iput-boolean p1, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToUpUsers:Z

    .line 45
    iget-boolean v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToUpUsers:Z

    if-eqz v0, :cond_9

    .line 46
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToComment:Z

    .line 48
    :cond_9
    return-void
.end method

.method public setSctollToComment(Z)V
    .registers 3
    .param p1, "scrollToComment"    # Z

    .prologue
    .line 51
    iput-boolean p1, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToComment:Z

    .line 52
    iget-boolean v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToComment:Z

    if-eqz v0, :cond_9

    .line 53
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/brixd/niceapp/util/DetailRequestCache;->mScrollToUpUsers:Z

    .line 55
    :cond_9
    return-void
.end method
